<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>测试发送</title>

</head>

<body>

    <input type="text" id="btn31" placeholder="注册的账号">
    <input type="text" id="btn32" placeholder="注册的密码">
    <button id="btn1">我是按钮1注册</button>
    <div>
        <input type="text" id="btn41" placeholder="登录的账号">
        <input type="text" id="btn42" placeholder="登录的密码">
        <button id="btn2">我是按钮2登录</button>
    </div>
    <div><button id="o">清空</button></div>
    <div></div><button id="btn6">访问my</button>
    <hr>
    <div></div><button id="getuserinfo">获取用户信息</button>
    <div>
        <input type="text" id="updateUserInfo1" placeholder="请输入nickname匿名">
        <input type="text" id="updateUserInfo2" placeholder="email">
        <button id="updateUserInfo3">更新用户数据</button>
    </div>

    <div>
        <input type="text" id="updatePassword1" placeholder="原来的密码">
        <input type="text" id="updatePassword2" placeholder="修改后的密码">
        <button id="updatePassword3">修改密码</button>
    </div>

    <div>
        <input type="text" id="avatar1" placeholder="avatar头像值">
        <button id="avatar2">更新用户头像</button>
    </div>
    <hr>
    <div>

        <button id="getArticleCates">获取文章分类数据列表【获取所有的表单数据】</button>
    </div>


    <div>
        <input type="text" id="addArticleCates1" placeholder="name">
        <input type="text" id="addArticleCates2" placeholder="alias别名">
        <button id="addArticleCates3">新增表单数据[整体操作一大类]</button>
    </div>


    <div>
        <input type="text" id="deletecate1" placeholder="删除的id值">

        <button id="deletecate2">删除表单数据【也是删除一大类】</button>
    </div>
    <hr>
    <div>
        <input type="text" id="cates11" placeholder="获取的id值">
        <button id="cates12">根据id获取表单数据【获取单个的表单数据】</button>
    </div>

    <div>
        <input type="text" id="updatecate1" placeholder="获取的id值">
        <input type="text" id="updatecate2" placeholder="获取的id值">
        <input type="text" id="updatecate3" placeholder="获取的id值">
        <button id="updatecate4">更新数据【更新对应的id的单个数据】</button>
    </div>

    <hr>
    <!-- 管理文章页面 -->

    <div>
        <input type="text" id="add" placeholder="获取的id值">
        <input type="text" id="updatecate2" placeholder="获取的id值">
        <input type="text" id="updatecate3" placeholder="获取的id值">
        <button id="updatecate4">更新数据【更新对应的id的单个数据】</button>
    </div>


    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script>
        let btn1 = $('#btn1');
        btn1.click(function() {
            var mima = $('#btn32').val()
            var zhanghao = $('#btn31').val()
            $.ajax('http://127.0.0.1:8080/api/reguser', {
                method: 'GET',
                headers: {
                    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrZW4iLCJpYXQiOjE1Mzc1NTQzMDksImRhdGEiOnsidXNlcm5hbWUiOiJ4dXRvbmdiYW8iLCJpc19zdXBlcnVzZXIiOjEsImlkIjoxNywibG9naW5fdGltZSI6MTUzNzU1NDMwOX0sImV4cCI6MTUzODE1NDMwOX0.32Lys4hjjY2XRpM2r9YSmpYA798u821m_M5Tzb6wxIU",
                    'Content-Type': 'application/json' //application/x-www-form-urlencoded  application/json
                },
                data: {
                    username: zhanghao,
                    password: mima
                },
                success: function(result) {
                    console.log(result);
                },
                error: function(err) {
                    console.log(err);
                }
            })
        })
        let btn2 = $('#btn2');
        btn2.click(function() {
            var mima = $('#btn42').val()
            var zhanghao = $('#btn41').val()
            $.ajax('http://127.0.0.1:8080/api/login', {
                method: 'GET',
                headers: {
                    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrZW4iLCJpYXQiOjE1Mzc1NTQzMDksImRhdGEiOnsidXNlcm5hbWUiOiJ4dXRvbmdiYW8iLCJpc19zdXBlcnVzZXIiOjEsImlkIjoxNywibG9naW5fdGltZSI6MTUzNzU1NDMwOX0sImV4cCI6MTUzODE1NDMwOX0.32Lys4hjjY2XRpM2r9YSmpYA798u821m_M5Tzb6wxIU",
                    'Content-Type': 'application/json' //application/x-www-form-urlencoded  application/json
                },
                data: {
                    username: zhanghao,
                    password: mima
                },
                success: function(result) {
                    console.log(result);
                },
                error: function(err) {
                    console.log(err);
                }
            })
        })
        $('#o').click(function(e) {
            $('#btn42').val('')
            $('#btn41').val('')
            $('#btn32').val('')
            $('#btn31').val('')

        });
        $('#btn6').click(function(e) {
            $.ajax('http://127.0.0.1:8080/my/article/updatecate', {

                method: 'GET',
                // beforeSend: function(request) {
                //     request.setRequestHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZC…cxNn0.8-eDN0OR00vvmzX8dstXKRi1Z3nXKZVHUfAL4NeYNak");
                // // },
                data: {
                    Id: '1',
                    name: 'fds',
                    alias: 'aaaafdsaaa',
                    avatar: 'fdsfdas'
                },
                headers: {
                    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OCwidXNlcm5hbWUiOiJhZG1pbjMiLCJwYXNzd29yZCI6IiIsIm5pY2tuYW1lIjpudWxsLCJlbWFpbCI6bnVsbCwidXNlcl9waWMiOiIiLCJpYXQiOjE2NzkzODY2OTIsImV4cCI6MTY3OTQyMjY5Mn0.9vxThd6TK2ydL04-0jW88T2TDMOtMDflUyoHu2OvJAw",
                    'Content-Type': 'application/json' //application/x-www-form-urlencoded  application/json
                },

                success: function(result) {
                    console.log(result);
                },
                error: function(err) {
                    console.log(err);
                }
            })
        });

        $('#getuserinfo').click(function(e) {
            $.ajax('http://127.0.0.1:8080/my/userinfo', {

                method: 'GET',
                // beforeSend: function(request) {
                //     request.setRequestHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZC…cxNn0.8-eDN0OR00vvmzX8dstXKRi1Z3nXKZVHUfAL4NeYNak");
                // // },
                data: {
                    Id: '1',
                    name: 'fds',
                    alias: 'aaaafdsaaa',
                    avatar: 'fdsfdas'
                },
                headers: {
                    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTEsInVzZXJuYW1lIjoiemh1amlhbGUiLCJwYXNzd29yZCI6IiIsIm5pY2tuYW1lIjpudWxsLCJlbWFpbCI6bnVsbCwidXNlcl9waWMiOiIiLCJpYXQiOjE2Nzk0NDQ4MTUsImV4cCI6MTY3OTQ4MDgxNX0.LK4tOoPmxAr8pbJqU3gNZbWVVC5LhY2UIfnxTqXGVtA",
                    'Content-Type': 'application/json' //application/x-www-form-urlencoded  application/json
                },

                success: function(result) {
                    console.log(result);
                },
                error: function(err) {
                    console.log(err);
                }
            })
        });

        let updateUserInfo = $('#updateUserInfo3');
        updateUserInfo.click(function() {
            var mima = $('#updateUserInfo1').val()
            var zhanghao = $('#updateUserInfo2').val()
            $.ajax('http://127.0.0.1:8080/my/userinfo1', {
                method: 'GET',
                headers: {
                    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTEsInVzZXJuYW1lIjoiemh1amlhbGUiLCJwYXNzd29yZCI6IiIsIm5pY2tuYW1lIjpudWxsLCJlbWFpbCI6bnVsbCwidXNlcl9waWMiOiIiLCJpYXQiOjE2Nzk0NDQ4MTUsImV4cCI6MTY3OTQ4MDgxNX0.LK4tOoPmxAr8pbJqU3gNZbWVVC5LhY2UIfnxTqXGVtA",
                    'Content-Type': 'application/json' //application/x-www-form-urlencoded  application/json
                },
                data: {
                    nickname: mima,
                    email: zhanghao
                },
                success: function(result) {
                    console.log(result);
                },
                error: function(err) {
                    console.log(err);
                }
            })
        });



        let updatePassword = $('#updatePassword3');
        updatePassword.click(function() {
            var mima = $('#updatePassword1').val()
            var zhanghao = $('#updatePassword2').val()
            $.ajax('http://127.0.0.1:8080/my/updatepwd', {
                method: 'GET',
                headers: {
                    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTEsInVzZXJuYW1lIjoiemh1amlhbGUiLCJwYXNzd29yZCI6IiIsIm5pY2tuYW1lIjpudWxsLCJlbWFpbCI6bnVsbCwidXNlcl9waWMiOiIiLCJpYXQiOjE2Nzk0NDQ4MTUsImV4cCI6MTY3OTQ4MDgxNX0.LK4tOoPmxAr8pbJqU3gNZbWVVC5LhY2UIfnxTqXGVtA",
                    'Content-Type': 'application/json' //application/x-www-form-urlencoded  application/json
                },
                data: {

                    oldPwd: mima,
                    newPwd: zhanghao,
                },
                success: function(result) {
                    console.log(result);
                },
                error: function(err) {
                    console.log(err);
                }
            })
        });


        let avatar = $('#avatar2');
        avatar.click(function() {
            var mima = $('#avatar1').val()

            $.ajax('http://127.0.0.1:8080/my/update/avatar', {
                method: 'GET',
                headers: {
                    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTEsInVzZXJuYW1lIjoiemh1amlhbGUiLCJwYXNzd29yZCI6IiIsIm5pY2tuYW1lIjpudWxsLCJlbWFpbCI6bnVsbCwidXNlcl9waWMiOiIiLCJpYXQiOjE2Nzk0NDQ4MTUsImV4cCI6MTY3OTQ4MDgxNX0.LK4tOoPmxAr8pbJqU3gNZbWVVC5LhY2UIfnxTqXGVtA",
                    'Content-Type': 'application/json' //application/x-www-form-urlencoded  application/json
                },
                data: {

                    avatar: mima,

                },
                success: function(result) {
                    console.log(result);
                },
                error: function(err) {
                    console.log(err);
                }
            })
        })


        $('#getArticleCates').click(function(e) {
            $.ajax('http://127.0.0.1:8080/my/article/cates', {

                method: 'GET',
                // beforeSend: function(request) {
                //     request.setRequestHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZC…cxNn0.8-eDN0OR00vvmzX8dstXKRi1Z3nXKZVHUfAL4NeYNak");
                // // },
                data: {
                    Id: '1',
                    name: 'fds',
                    alias: 'aaaafdsaaa',
                    avatar: 'fdsfdas'
                },
                headers: {
                    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTEsInVzZXJuYW1lIjoiemh1amlhbGUiLCJwYXNzd29yZCI6IiIsIm5pY2tuYW1lIjpudWxsLCJlbWFpbCI6bnVsbCwidXNlcl9waWMiOiIiLCJpYXQiOjE2Nzk0NDQ4MTUsImV4cCI6MTY3OTQ4MDgxNX0.LK4tOoPmxAr8pbJqU3gNZbWVVC5LhY2UIfnxTqXGVtA",
                    'Content-Type': 'application/json' //application/x-www-form-urlencoded  application/json
                },

                success: function(result) {
                    console.log(result);
                },
                error: function(err) {
                    console.log(err);
                }
            })
        });


        let addArticleCates = $('#addArticleCates3');
        addArticleCates.click(function() {
            var mima = $('#addArticleCates1').val()
            var mima1 = $('#addArticleCates2').val()

            $.ajax('http://127.0.0.1:8080/my/article/addcates', {
                method: 'GET',
                headers: {
                    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTEsInVzZXJuYW1lIjoiemh1amlhbGUiLCJwYXNzd29yZCI6IiIsIm5pY2tuYW1lIjpudWxsLCJlbWFpbCI6bnVsbCwidXNlcl9waWMiOiIiLCJpYXQiOjE2Nzk0NDQ4MTUsImV4cCI6MTY3OTQ4MDgxNX0.LK4tOoPmxAr8pbJqU3gNZbWVVC5LhY2UIfnxTqXGVtA",
                    'Content-Type': 'application/json' //application/x-www-form-urlencoded  application/json
                },
                data: {

                    name: mima,
                    alias: mima1,


                },
                success: function(result) {
                    console.log(result);
                },
                error: function(err) {
                    console.log(err);
                }
            })
        })


        let deletecate = $('#deletecate2');
        deletecate.click(function() {
            var mima = $('#deletecate1').val()


            $.ajax('http://127.0.0.1:8080/my/article/deletecate', {
                method: 'GET',
                headers: {
                    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTEsInVzZXJuYW1lIjoiemh1amlhbGUiLCJwYXNzd29yZCI6IiIsIm5pY2tuYW1lIjpudWxsLCJlbWFpbCI6bnVsbCwidXNlcl9waWMiOiIiLCJpYXQiOjE2Nzk0NDQ4MTUsImV4cCI6MTY3OTQ4MDgxNX0.LK4tOoPmxAr8pbJqU3gNZbWVVC5LhY2UIfnxTqXGVtA",
                    'Content-Type': 'application/json' //application/x-www-form-urlencoded  application/json
                },
                data: {

                    id: mima



                },
                success: function(result) {
                    console.log(result);
                },
                error: function(err) {
                    console.log(err);
                }
            })
        });
        let cates1 = $('#cates12');
        cates1.click(function() {
            var mima = $('#cates11').val()


            $.ajax('http://127.0.0.1:8080/my/article/cates1', {
                method: 'GET',
                headers: {
                    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTEsInVzZXJuYW1lIjoiemh1amlhbGUiLCJwYXNzd29yZCI6IiIsIm5pY2tuYW1lIjpudWxsLCJlbWFpbCI6bnVsbCwidXNlcl9waWMiOiIiLCJpYXQiOjE2Nzk0NDQ4MTUsImV4cCI6MTY3OTQ4MDgxNX0.LK4tOoPmxAr8pbJqU3gNZbWVVC5LhY2UIfnxTqXGVtA",
                    'Content-Type': 'application/json' //application/x-www-form-urlencoded  application/json
                },
                data: {

                    id: mima



                },
                success: function(result) {
                    console.log(result);
                },
                error: function(err) {
                    console.log(err);
                }
            })
        })


        let updatecate = $('#updatecate4');
        updatecate.click(function() {
            var mima1 = $('#updatecate1').val()
            var mima2 = $('#updatecate2').val()
            var mima3 = $('#updatecate3').val()



            $.ajax('http://127.0.0.1:8080/my/article/updatecate', {
                method: 'GET',
                headers: {
                    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTEsInVzZXJuYW1lIjoiemh1amlhbGUiLCJwYXNzd29yZCI6IiIsIm5pY2tuYW1lIjpudWxsLCJlbWFpbCI6bnVsbCwidXNlcl9waWMiOiIiLCJpYXQiOjE2Nzk0NDQ4MTUsImV4cCI6MTY3OTQ4MDgxNX0.LK4tOoPmxAr8pbJqU3gNZbWVVC5LhY2UIfnxTqXGVtA",
                    'Content-Type': 'application/json' //application/x-www-form-urlencoded  application/json
                },
                data: {

                    Id: mima1,
                    name: mima2,
                    alias: mima3



                },
                success: function(result) {
                    console.log(result);
                },
                error: function(err) {
                    console.log(err);
                }
            })
        })
    </script>
</body>

</html>